package com.sitechasia.webx.components.xtable.toolbar;

import org.extremecomponents.table.core.TableModel;
import org.extremecomponents.table.view.HtmlView;
import org.extremecomponents.util.HtmlBuilder;

//该类实现由 张志辉 zhangzhihui@myce.net.cn 提供实现
public class CustomToolbarFooterView extends HtmlView {
	@Override
	protected void beforeBodyInternal(TableModel model) {
		getTableBuilder().tableStart();
		getTableBuilder().getHtmlBuilder().tr(2).close();
		getTableBuilder().getHtmlBuilder().td(2).width("100%").close();
		getTableBuilder().getHtmlBuilder().table(2).styleClass("DoubleColorTable1").width("100%").cellPadding("0")
				.cellSpacing("0").close();
		// getTableBuilder().theadStart();
		// statusBar(getHtmlBuilder(), getTableModel());
		getTableBuilder().filterRow();
		getTableBuilder().headerRow();
		// getTableBuilder().theadEnd();
		// getTableBuilder().tbodyStart();
	}

	@Override
	protected void afterBodyInternal(TableModel model) {
		getCalcBuilder().defaultCalcLayout();
		// getTableBuilder().tbodyEnd();
		getTableBuilder().getHtmlBuilder().tableEnd(2);
		toolbar(getHtmlBuilder(), getTableModel());
		getTableBuilder().tableEnd();
	}

	protected void toolbar(HtmlBuilder html, TableModel model) {
		// (new ExToolbar(html, model)).layout();
		(new CustomToolbar(html, model)).layout();
	}

	protected void statusBar(HtmlBuilder html, TableModel model) {
		// (new ExToolbar(html, model)).layout();
		(new CustomToolbar(html, model)).layout();
	}
}